<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      lang="zh-cn">
<head>
    <meta content="云之讯,云通讯,云通讯平台" name="keywords"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
    <title>短信平台运营系统 </title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link th:href="@{/resources/css/bootstrap.min14ed.css?v=3.3.6}" rel="stylesheet">
    <link th:href="@{/resources/css/font-awesome.min93e3.css?v=4.4.0}" rel="stylesheet">
    <!-- jqgrid-->
    <link th:href="@{/resources/css/plugins/jqgrid/ui.jqgridffe4.css?0820}" rel="stylesheet">
    <link th:href="@{/resources/css/animate.min.css}" rel="stylesheet">
	<link th:href="@{/resources/css/plugins/sweetalert/sweetalert.css}" rel="stylesheet">

	<link th:href="@{/resources/css/style.min862f.css?v=4.1.0}" rel="stylesheet">
    <style>
        /* Additional style to fix warning dialog position */
        #alertmod_table_list_2 {
            top: 900px !important;
        }
    </style>
</head>
<body class="gray-bg"><div th:replace="stat :: statCode"></div>
	<div class="wrapper wrapper-content animated fadeInRight">

	    <div class="row">
	        <div class="col-sm-12">
	            <div class="ibox "> 
		                <div class="ibox-title">
		                    <h5>品牌受理</h5>
		                </div>
	                <div class="ibox-content">

						<div class="pull-right tooltip-demo">
							<!--<a class="btn btn-danger btn-sm" data-toggle="tooltip" data-placement="top" title="返回" onclick="javascript:self.location=document.referrer;"><i class="fa fa-reply"></i>&nbsp;返回</a>-->
						</div>
	                    <div class="row">
	                        <div class="col-sm-6 b-r">
	                            <form class="form-horizontal m-t" id="manager_form">
	                                <div class="form-group">
									    <label class="col-sm-3 control-label">企业名称:</label>
										<div class="col-sm-8">
											<p class="form-control-static" th:text="${data.company}"> xxxx </p>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label">联系地址:</label>
										<div class="col-sm-8">
											<p class="form-control-static" th:text="${data.address}"> xxxx </p>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label">邮箱:</label>
										<div class="col-sm-8">
											<p class="form-control-static" th:text="${data.email}"> xxxx </p>
										</div>
										<input id="email" type="hidden" th:value="${data.email}">
										<input id="applyId" type="hidden" th:value="${applyId}">
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label">手机号码:</label>
										<div class="col-sm-8">
											<p class="form-control-static" th:text="${data.mobile}"> xxxx </p>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label">归属销售:</label>
										<div class="col-sm-8" style="width: 250px">

											<select class="form-control" name="saleSelect" id="saleSelect">
												<option value="">请选择销售</option>
												<option th:each="sale : ${saleList}" th:value="${sale.id}" th:text="${sale.name}">选项 4</option>
											</select>

										</div>
										<!--<div class="col-sm-8" style="width: 100px">-->
											<!--<span>-->
												<!--<button type="button" class="btn btn-primary" data-toggle="modal" data-target="" onclick="addSaleBox()">添加销售</button>-->
											<!--</span>-->
										<!--</div>-->

									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label">备注:</label>
										<div class="col-sm-8">
											<p class="form-control-static" th:text="${data.remark}"> xxxx </p>
										</div>
									</div>
									<div class="form-group">
										<label class="col-sm-3 control-label">受理原因:</label>
										<div class="col-sm-8">
											<input type="text" id="reason" name="" class="form-control" placeholder="请填写受理原因或不填">
										</div>
									</div>

									<div class="form-group">
										<div class="col-sm-8 col-sm-offset-3">
											<button type="button" class="btn btn-sm btn-primary"  onclick="brandConfirmAccept()" >确定受理</button>
											&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
											<button type="button" class="btn btn-sm"  onclick="goback()" >取消</button>
										</div>
									</div>

	                            </form>
	                        </div>
	                    </div>
	                </div>
	            </div>
	        </div>
	    </div>


	<script th:src="@{/resources/js/hex_ha_ha_ha_ha_ha.js}"></script>
	<script th:src="@{/resources/js/jquery.min.js?v=2.1.4}"></script>
	<script th:src="@{/resources/js/bootstrap.min.js?v=3.3.6}"></script>
	<script th:src="@{/resources/js/plugins/peity/jquery.peity.min.js}"></script>
	<script th:src="@{/resources/js/content.min.js?v=1.0.0}"></script>
	<script th:src="@{/resources/js/date_format.min.js?v=1.0.0}"></script>
	<script th:src="@{/resources/js/jquery.form.js?v=1.0.0}"></script>

	<script th:src="@{/resources/js/plugins/sweetalert/sweetalert.min.js}"></script>
	<script th:src="@{/resources/js/plugins/validate/jquery.validate.min.js}"></script>
	<script th:src="@{/resources/js/layer/layer.js}"></script>

	<script th:inline="javascript">
		/*<![CDATA[*/
		 
  	 
	function goback(){
		window.history.back();
	}


	//msg消失时间
	var msgTime = 1500;
//	function addSaleBox() {
//
//	    var url = /*[[@{/accountInfo/applyRecord/addSalePage}]]*/;
//
//        layer.open({
//            type: 2,
//            title: ['添加销售', 'font-size:20px;font-weight: 900'],
//            closeBtn: 2,
//            area: ['400px', '300px'],
//            fix: false, //不固定
//            content: url
//        });
//    }


    //品牌确认受理
	var accept_falg = false; //防止重复提交
    function brandConfirmAccept() {
        if(accept_falg == true){
            return;
		}
	    var applyId = $("#applyId").val();//修改应用
	    var email = $("#email").val();    //判断用户
		var reason = $("#reason").val();  //受理原因

		var saleId = $("#saleSelect").val();//归属销售id
		if(saleId == null || saleId == ''){
            layer.msg("请选择归属销售！", {icon: 2,time: msgTime});
		    return;
		}

        accept_falg = true;
        $.ajax({
            url: /*[[@{/accountInfo/applyRecord/brandConfirmAccept}]]*/,
            type:"POST",
            data:{
                applyId: applyId,
                email:email,
                reason:reason,
                belongSale:saleId
            },
            success:function(data){

                accept_falg = false;

                if(data == null){
                    layer.msg(data.msg, {icon: 2,time: msgTime});
                }else if(data.success == true){
                    layer.msg(data.msg, {icon: 1,time: msgTime},function(){
                        //刷新页面
						var viewUrl = /*[[@{/accountInfo/applyRecord/query}]]*/;
                        window.location.href = viewUrl;
                    });
                }else{
                    layer.msg(data.msg, {icon: 2,time: msgTime});
                }
            },
            complete: function(XMLHttpRequest, textStatus) {accept_falg = false;}
        });


    }



	    /*]]>*/
	    
	</script>
</body>
</html>